<template>
	<el-form-item :label="info.label">
		<el-input class="input-width" size="small" v-model="inputData" :placeholder="info.label"></el-input>
	</el-form-item>
</template>

<script>
	export default {
		props: ['toolInfo', 'reset'],
		data(){
			return {
				inputData: '',
				info: this.toolInfo
			}
		},
		method: {

		},
		watch: {
			// 监听父组件的toolInfo变量
			'toolInfo': function(value){
				this.info = value;
			},
			// 监听父组件的reset状态
			'reset': function(){
				this.inputData = '';
			},
			// 向父组件传输inputData数据
			'inputData': function(value){
				this.$emit('message', this.info.fieldName, 'input', value);
			}
		}
	}
</script>

<style>
	.input-width{
		width: 215px !important;
	}
</style>